/**
 * The polyline is a customizable line. It consits of several locations
 * that will be used as vertexes to draw the line.
 * A polyline is normally used to mark a specific route on the map.
 * 
 * @author Kim Pommert
 * @version %I%, %G%
 */
qx.Class.define("qooxdoosample.cocktail.util.overlays.Polyline",
{
	extend: qooxdoosample.cocktail.util.overlays.Overlay,
		
	/**
	 * Class constructor.
	 * Instantiates an object of that class.
	 * 
	 * @param points	{Array} The list of points that are used as vertex of that line
	 */
	construct: function(points)
	{
		this.setPoints(points);	
		this.setColor("#ff0000");
		this.setWidth(5);
		this.setLineOpacity(1.0);
		this.setGeodesic(false);
	},
	
	properties :
	{
    	/**
    	 * The geographic location of all vertexes of this object.
    	 */
    	points:
    	{
      		nullable: true,
      		init: null,
      		check: "Array"
      	},
      	
      	/**
      	 * the color of the line.
		 * The color is a string in HTML hex representation.
      	 */
      	color:
      	{
      		nullable: false,
      		init: "#ff0000",
      		check: "String"
      	},
      	
      	/**
      	 * The width of the line.
      	 */
      	width:
      	{
      		nullable: false,
      		init: 5,
      		check: "Integer"
      	},
      	
      	/**
      	 * The opacity of the line.
		 * The value is a float between 0.0 and 1.0
      	 */
      	lineOpacity:
      	{
      		nullable: false,
      		init: 1.0,
      		check: "Number"
      	},
      	
      	/**
      	 * Two points of a line are normally connected by a straight line.
		 * The earth curvature is not considered in that representation.
		 * This can be changed by setting this flag to <code>true</code>.
      	 */
      	geodesic:
      	{
      		nullable: false,
      		init: false,
      		check: "Boolean"
      	}
	},
	
	members:
	{

		
		/**
		 * Get the location where the line starts.
		 * 
		 * @return	{qooxdoosample.cocktail.util.LatLng} the start point of the line
		 */
		getStartPoint: function()
		{
			var points = this.getPoints();
			return points[0];
		},
		
		/**
		 * Get the location where the line ends.
		 * 
		 * @return {qooxdoosample.cocktail.util.LatLng} the end point of the line
		 */
		getEndPoint: function()
		{
			var points = this.getPoints();
			return points[points.length - 1];
		}
		
		
	}
});